// 封装
type Any=string|number|boolean|null|undefined|{[key:string]:any}// 自定义类型
export const set=(key:string,val:Any)=>{
   window.sessionStorage.setItem(key,JSON.stringify(val))
}

export const get=(key:string):Any=>{
   let res:Any=window.sessionStorage.getItem(key)
   if(res==null){
     return null
   }
   if(res=='undefined'){
      return undefined
   }
   let rst=JSON.parse(res)
   return rst
}

export const clear=()=>{
    window.sessionStorage.clear()
}